{% extends "shop/base.html" %}

{% load static %}

{% block title %}
    {{ product.name }}
{% endblock %}
{% block content %}
    <div class="product-detail">
        <img src="{% if product.image %}{{ product.image.url }}{% else %}
                  {% static "img/no_image.png" %}{% endif %}">
        <h1>{{ product.name }}</h1>
        <h2>
            <a href="{{ product.category.get_absolute_url }}">{{product.category }}</a>
        </h2>
        <p class="price">${{ product.price }}</p>
        {{ product.description|linebreaks }}
        Views: {{ number_views }}
        <form action="{% url "cart:add_product" slug=product.slug %}" method="post">
            {% csrf_token %}
            {{ add_product_form.as_p }}
            <input type="submit" value="Add to cart">
        </form>
    </div>
{% endblock %}
